refactor: centralize XML import payload loading#280
Merged
TheWitness merged 1 commit intoCacti:developfrom Mar 16, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes the duplicated “XML import payload loading” logic (text area vs uploaded file, otherwise redirect/exit) into a shared helper in functions.php, and updates the alert/report/removal import handlers to use it—addressing issue #277.
Changes:
- Add
syslog_get_import_xml_payload($redirect_url)helper to load XML from request text or uploaded file, otherwise redirect/exit. - Update
alert_import(),report_import(), andremoval_import()to use the shared helper. - Add a regression test ensuring all three handlers call the helper and remove legacy per-file upload handling; update changelog.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
functions.php |
Introduces shared XML import payload loader helper. |
syslog_alerts.php |
Replaces duplicated payload loading with helper call in alert_import(). |
syslog_reports.php |
Replaces duplicated payload loading with helper call in report_import(). |
syslog_removal.php |
Replaces duplicated payload loading with helper call in removal_import(). |
tests/regression/issue277_import_payload_loader_test.php |
Adds regression test to enforce helper usage and legacy logic removal. |
CHANGELOG.md |
Documents issue #277 change. |
052bf88 to
1882acb
Compare
TheWitness
requested changes
Mar 10, 2026
Member
TheWitness
left a comment
There was a problem hiding this comment.
Another good one. Fix the merge conflicts and we should be okay.
45ff495 to
6d038f3
Compare
Contributor
Author
|
Rebased, CHANGELOG conflicts resolved. |
somethingwithproof
added a commit
to somethingwithproof/plugin_syslog
that referenced
this pull request
Mar 10, 2026
Refs Cacti#280 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
6d038f3 to
b63a05c
Compare
somethingwithproof
added a commit
to somethingwithproof/plugin_syslog
that referenced
this pull request
Mar 12, 2026
Refs Cacti#280 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
b63a05c to
84ac26e
Compare
Refs Cacti#280 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
84ac26e to
317c3c0
Compare
TheWitness
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #277
Validation